package com.kynnnn.cloud.quartz.job;

import com.kynnnn.cloud.quartz.config.LocalEnv;
import com.kynnnn.cloud.quartz.service.UserService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

@Component
@DisallowConcurrentExecution
public class JobTwo extends QuartzJobBean {
    //不能使用注入的方式，只能使用DateMap方式传入参数
    private UserService userService;

    private LocalEnv localEnv;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        userService.getUserAddr();
        System.out.println("remote: " + localEnv.getRemote());
    }

    public void setUserService(UserService userService) {
        this.userService = userService;

    }

    public void setLocalEnv(LocalEnv localEnv) {
        this.localEnv = localEnv;
    }

}
